package cn.vijay.boot.autoconfigure.sms;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(SmsProperties.class)
public class SmsAutoConfiguration {


    @Bean
    @ConditionalOnProperty(prefix = "sms", name = "name")
    public SmsSender smsSender(SmsProperties smsProperties) {
        SmsSender smsSender = new SmsSender();
        smsSender.setSendName(smsProperties.getName());
        return smsSender;
    }

}
